import mongoose, { Schema, Document } from 'mongoose';

// 定义用户接口
interface IUser extends Document {
    userId: string;
    userName: string;
    password: string;
    friends:Array<string>;
}

// 定义用户模式
const UserSchema = new Schema<IUser>({
    userId: { type: String, required: true },
    userName: { type: String, unique: true },
    password: { type: String, required: true },
    friends: { type: [String] },
});

// 创建用户模型
const UserDB = mongoose.model<IUser>('User', UserSchema);

export default UserDB;

